<?php
	//if a type need taxonomy sidebar, use this code
	$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
	if($type_taxonomy_value){
		$tax_filter = array(
			'taxonomy' => $type_taxonomy,
			'field'    => 'slug',
			'terms' => $type_taxonomy_value,
		);
	} 
	$query_args = array(
		'post_type' => $type,
		'posts_per_page' => $posts_per_page,
		'orderby' => 'date',
		'order' => 'DESC',
		'post_status' => 'publish',
		'paged' => $paged,
		'tax_query' => array(
			$tax_filter
		)
	  );
	  // create a new instance of WP_Query
	 $the_query = new WP_Query( $query_args );
?>

	<div class="page-content">
		<div class="page-sidebar-wrapper">
			<div class="row">
		
				<aside id="main-sidebar" class="col-xs-12 col-sm-3 col-sm-push-9 type-sidebar">
					<?php get_template_part("template-parts/type/sidebar/sidebar", $type);?> 
				</aside>
					
				<?php 
					if($the_query->have_posts()){
						echo '<div class="col-xs-12 col-sm-9 col-sm-pull-3"><div class="articles-wrapper"><div class="row">'; //start loop
						 while ( $the_query->have_posts() ) : $the_query->the_post(); // run the loop
						get_template_part( 'template-parts/type/type', $type);
						endwhile;
						echo '</div></div>';
						
						if ( $the_query->max_num_pages > 1 ) :
							require( 'pagination-query.php');
						endif;
						
						echo '</div>';
					}// end loop
				?>
				
			</div>
		</div>
	</div>
				
<?php wp_reset_query();?>